vue3的computed计算属性传参 您所在的位置:网站首页 vue computed怎么传参 vue3的computed计算属性传参

vue3的computed计算属性传参

2024-07-17 13:44| 来源: 网络整理| 查看: 265

更多前端资料,《前端Tool》小程序。

在使用计算属性时,尤其是有v-for和slot插槽的使用时,进行一些参数的传递。

1. 在v-for中使用计算属性传参。

是否显示 import {computed} from 'vue' const currentId=ref(null) const isShow=computed(()=>(item:any)=>{ //计算属性传递参数 return currentId=== item.id })

2. 在slot插槽中计算属性传参。

{{getCurrentDayDetailed(scope.item)}} const getCurrentDayDetailed = computed(() => (item: any) => { return item.id==='123' })



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有